package com.ghy.dto;

import com.ghy.constant.RE;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @author GaoHeYang
 */
@Schema(name = "菜单添加DTO")
@Data
public class MenuInsertDTO implements Serializable , RE {
    @NotEmpty(message ="标题不能为空")
    @Pattern(regexp = TITLE_RE, message = TITLE_RE_MSG)
    @Schema(description = "标题")
    private String title;

    @NotEmpty(message="描述不能为空")
    @Pattern(regexp= INFO_RE, message = INFO_RE_MSG)
    @Schema(description = "描述")
    private String info;

    @Pattern(regexp =MENU_URL_RE, message = MENU_URL_RE_MSG)
    @Schema(description = "跳转地址")
    private String url;

    @NotEmpty(message = "图标不能为空")
    @Pattern(regexp = MENU_ICON_RE, message = MENU_ICON_RE_MSG)

    @Schema(description = "图标")
    private String icon;

    @Range(min = 0,message = "父菜单主键最小为e")
    @Schema(description ="父菜单主键，θ视为根节点")
    private Long pid;

    @NotNull(message="序号不能为空")
    @Range(min = 0,message ="序号最小为o")
    @Schema(description = "序号")
    private Long idx;



}
